import Layout from '../views/Layout'

import store from '../store/index'

let routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login')
  },
  {
    path: '*',
    name: '404',
    component: () => import('@/views/Error/404')
  }
]

const whiteList = ['login', '404']
routes = routes.concat(store.state.menuList)

routes.forEach(el => {
  if (!whiteList.includes(el.name)) {
    el.component = Layout
  }
})

export default routes
